* @param string $pageStatus
* @throws MWException
*/
- public function actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit,
- $oldid, $watchers, $pageStatus = 'changed' ) {
+ public function actuallyNotifyOnPageChange(
+ $editor,
+ $title,
+ $timestamp,
+ $summary,
+ $minorEdit,
+ $oldid,
+ $watchers,
+ $pageStatus = 'changed'
+ ) {
# we use $wgPasswordSender as sender's address
global $wgUsersNotifiedOnAllChanges;
global $wgEnotifWatchlist, $wgBlockDisablesLogin;
global $wgEnotifMinorEdits, $wgEnotifUserTalk;
+ $messageCache = MediaWikiServices::getInstance()->getMessageCache();
+
# The following code is only run, if several conditions are met:
# 1. EmailNotification for pages (other than user_talk pages) must be enabled
# 2. minor edits (changes) are only regarded if the global flag indicates so
&& $this->canSendUserTalkEmail( $editor, $title, $minorEdit )
) {
$targetUser = User::newFromName( $title->getText() );
- $this->compose( $targetUser, self::USER_TALK );
+ $this->compose( $targetUser, self::USER_TALK, $messageCache );
$userTalkId = $targetUser->getId();
}
&& !( $wgBlockDisablesLogin && $watchingUser->getBlock() )
&& Hooks::run( 'SendWatchlistEmailNotification', [ $watchingUser, $title, $this ] )
) {
- $this->compose( $watchingUser, self::WATCHLIST );
+ $this->compose( $watchingUser, self::WATCHLIST, $messageCache );
}
}
}
continue;
}
$user = User::newFromName( $name );
- $this->compose( $user, self::ALL_CHANGES );
+ $this->compose( $user, self::ALL_CHANGES, $messageCache );
}
$this->sendMails();
/**
* Generate the generic "this page has been changed" e-mail text.
+ * @param MessageCache $messageCache
*/
- private function composeCommonMailtext() {
+ private function composeCommonMailtext( MessageCache $messageCache ) {
global $wgPasswordSender, $wgNoReplyAddress;
global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
global $wgEnotifImpersonal, $wgEnotifUseRealName;
$body = wfMessage( 'enotif_body' )->inContentLanguage()->plain();
$body = strtr( $body, $keys );
- $body = MessageCache::singleton()->transform( $body, false, null, $this->title );
+ $body = $messageCache->transform( $body, false, null, $this->title );
$this->body = wordwrap( strtr( $body, $postTransformKeys ), 72 );
# Reveal the page editor's address as REPLY-TO address only if
* Call sendMails() to send any mails that were queued.
* @param User $user
* @param string $source
+ * @param MessageCache $messageCache
*/
- private function compose( $user, $source ) {
+ private function compose( $user, $source, MessageCache $messageCache ) {
global $wgEnotifImpersonal;
if ( !$this->composed_common ) {
- $this->composeCommonMailtext();
+ $this->composeCommonMailtext( $messageCache );
}
if ( $wgEnotifImpersonal ) {